package com.example.actionbardemo;

import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.SearchView;
import android.widget.ShareActionProvider;
import android.widget.Toast;

public class OperateViewActivity extends FuncListActivity {

	@Override
	public int getContentViewID() {
		return R.layout.activity_operate_view;
	}

	@Override
	public boolean isBackIconVisible() {
		return true;
	}

	@Override
	public void initView() {

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.operate_view, menu);  //必须先加载菜单,少了这一步后面menu会报空指针.
		//搜索菜单
		MenuItem searchItem = menu.findItem(R.id.menu_search);
		SearchView mSearchView = (SearchView) searchItem.getActionView();
		
		
		//分享菜单
		MenuItem shareItem = menu.findItem(R.id.menu_share);
		ShareActionProvider mShareActionProvider = (ShareActionProvider) shareItem.getActionProvider();
		//通过哪些渠道分享.
		Intent shareIntent = new Intent(Intent.ACTION_SEND);
		shareIntent.setType("image/*");
		mShareActionProvider.setShareIntent(shareIntent);
		return super.onCreateOptionsMenu(menu);
	}
}
